import time

import requests

# 图片的url
url = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1604375354920&di=3404a072a89eaf3476b0ac01f6045c55&imgtype=0&src=http%3A%2F%2Fcdn.duitang.com%2Fuploads%2Fitem%2F201411%2F29%2F20141129212359_cLvTh.thumb.700_0.jpeg'

# 响应本身就是一个图片,并且是二进制类型
r = requests.get(url)

print(r.content)

# 以二进制+写入的方式打开文件
with open('海绵宝宝.png', 'wb') as f:
    # r.content bytes二进制类型
    f.write(r.content)
